Advertisement
pleasedontcode

OLED Showcase rev_02

May 2nd, 2024
772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: OLED Showcase
  13.     - Source Code NOT compiled for: ESP32 DevKit V1
  14.     - Source Code created on: 2024-05-03 03:54:30
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Writing Helo */
  21. /****** SYSTEM REQUIREMENT 2 *****/
  22.     /* Analog clock show time */
  23. /****** END SYSTEM REQUIREMENTS *****/
  24.  
  25. /****** DEFINITION OF LIBRARIES *****/
  26. #include <Wire.h>
  27. #include <Adafruit_SSD1306.h>   //https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED.git
  28.  
  29. /****** FUNCTION PROTOTYPES *****/
  30. void setup(void);
  31. void loop(void);
  32.  
  33. /***** DEFINITION OF I2C PINS *****/
  34. const uint8_t Vg_SSD1306OledDisplay_I2C_PIN_SDA_D21 = 21;
  35. const uint8_t Vg_SSD1306OledDisplay_I2C_PIN_SCL_D22 = 22;
  36. const uint8_t Vg_SSD1306OledDisplay_I2C_SLAVE_ADDRESS = 60;
  37.  
  38. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  39. Adafruit_SSD1306 display(Vg_SSD1306OledDisplay_I2C_PIN_SDA_D21, Vg_SSD1306OledDisplay_I2C_PIN_SCL_D22);
  40.  
  41. void setup(void)
  42. {
  43.     // put your setup code here, to run once:
  44.     display.begin(SSD1306_SWITCHCAPVCC, Vg_SSD1306OledDisplay_I2C_SLAVE_ADDRESS);
  45.     display.display();
  46.     delay(2000);
  47.     display.clearDisplay();
  48.  
  49.     /* Writing Hello */
  50.     display.setTextSize(2);
  51.     display.setTextColor(WHITE);
  52.     display.setCursor(10, 10);
  53.     display.println("Hello");
  54.  
  55.     /* Analog clock show time */
  56.     display.setTextSize(1);
  57.     display.setTextColor(WHITE);
  58.     display.setCursor(10, 30);
  59.     display.println("Analog Clock: 12:00");
  60.  
  61.     display.display();
  62.     delay(2000);
  63.     display.clearDisplay();
  64. }
  65.  
  66. void loop(void)
  67. {
  68.     // put your main code here, to run repeatedly:
  69. }
  70.  
  71. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement